<%= @uri %>
<div class="container">
  <div class="row">
    <div id="traveler_info" class="span8 offset1 bs-example">
      <h3>Order List</h3>
      <table width="100%">
        <% @results['myorder']['data'].each do |hotel| %>
          <tr>
            <td>
              <%= hotel['order_name'] %>
              <%= image_tag hotel['order_photo'].to_s %>
            </td>
            <td>
              <%= hotel['order_name_detail'] %>
            </td>
            <td>
              <%= hotel['detail']['rooms'].to_s+' room x '+ hotel['detail']['nights'].to_s+' night/s '+ number_to_currency(hotel['detail']['price'], :unit => "Rp. ", :delimiter => "," ,:precision => 0 )  %>
            </td>
            <td><%= hotel['detail']['startdate'].to_s+' until '+ hotel['detail']['enddate'] %></td>
            <td><%= link_to "Checkout", hotel_customer_checkout_path(order_id: @results['myorder']['order_id'], order_detail_id: hotel['order_detail_id']), class: "btn btn-primary" %></td>
          </tr>
        <% end %>
      </table>
    </div>
    <div id="hotel_summary" class="span2 bs-example">
      <h3>Reference Hotel</h3>
      <% @references['results']['result'].each_with_index do |ref, index| %>
        <% if index < 3 %>
          <!-- to make hotel detail link -->
          <% l = ref["business_uri"].split('?').first %>
          <% u = URI.parse(ref["business_uri"].to_s) %>
          <% p = CGI.parse(u.query) %>
         
          <!-- end to make hotel detail link -->
          <div>
            <table >
              <tr>
                <td>
                 <%= link_to ref['name'],{controller: "hotel_ticket", action: "hotel_ticket_detail", name: l.split('/hotel/').last ,startdate: p["startdate"].first, enddate: p["enddate"].first, night: p["night"].first, room: p["room"].first, adult: p["adult"].first, child: p["child"].first, uid: p["uid"].first} , style: "font-size:0.6em;" %>
                </td>
              </tr>
              <tr>
                <td><%= number_to_currency(ref['price'], :unit => "Rp. ", :delimiter => "," ,:precision => 0 ).to_s+' *'+ref['rating'].to_s %></td>
              </tr>
              <tr>
                <td>
                <%= link_to raw(image_tag ref['photo_primary']).to_s,{controller: "hotel_ticket", action: "hotel_ticket_detail", name: l.split('/hotel/').last ,startdate: p["startdate"].first, enddate: p["enddate"].first, night: p["night"].first, room: p["room"].first, adult: p["adult"].first, child: p["child"].first, uid: p["uid"].first} , style: "font-size:0.6em;" %>
                </td>
              </tr>
            </table>
          </div>
        <% end %>
      <% end %>
    </div>
  </div>
</div>